package com.haixiaoke.flat.house.controller;

import com.haixiaoke.auth.AuthCheck;
import com.haixiaoke.saas.common.core.domain.AjaxResult;
import com.haixiaoke.saas.house.domain.HouseLead;
import com.haixiaoke.saas.house.service.IHouseLeadService;
import com.haixiaoke.saas.system.BaseController;
import com.haixiaoke.token.FrontTokenComponent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author panda
 * @Date 2025/7/10
 **/
@RestController
@RequestMapping("/front/flat/house/houseLead")
public class FlatHouseLeadController extends BaseController {
    @Autowired
    private IHouseLeadService houseLeadService;
    @Autowired
    private FrontTokenComponent frontTokenComponent;

    /**
     * 新增预定
     * @param houseLead
     * @return
     */
    @AuthCheck
    @PostMapping
    public AjaxResult add(@RequestBody HouseLead houseLead) {
        houseLead.setCreateBy(frontTokenComponent.getLoginUser().getUser().getUserName());
        return houseLeadService.insertHouseLead(houseLead);
    }
}
